repeat until number of chars of line 3 of it > 6 and the commandKey is up
put "Select file for Jupiter Galilean Satellite Events..."
put filename("TEXT") into path
if path is empty then exit repeat
put " -- "&path into line 3 of it
set script of cd Jupiter to it
put true into npath
end repeat
hide message box
put char 1 to 3 of second word of nDate(1,12,0) && first word of nDate(1,12,0) into he
if not((second word of he) = first word of fld "date") or force or npath then fetch he
central
end JFetch
on central
set cursor to watch
put 2*pi into p2
put pi/180 into fac
put -2451544.99934 + last word of first line of fld JD into d
put d/36525+1 into t
put p2*(frac(.779072+.00273790931*d)) into l0
put p2*(frac(.993126+.0027377785*d)) into g0
put p2*(frac(.089608+.00023080893*d)) into l5
put p2*(frac(.056531+.00023080893*d)) into g5
put p2*(frac(.882987+.00009294371*d)) into g6
put ((6910-17*t)*sin(g0)+72*sin(2*g0)-7*cos(g0-g5))/206265+l0 into l
put 1.00014-.01675*cos(g0)-.00014*cos(2*g0) into r
put 19934*sin(g5)+5023*t+2511+1093*cos(2*g5-5*g6)+601*sin(2*g5)-479* sin(2*g5-5*g6)-185*sin(2*g5-2*g6)+137*sin(3*g5-5*g6)-131*sin(g5-2*g6) into j
put -4692*cos(g5)+(30*t+259)*sin(g5)+227-227*cos(2*g5) into b
put 5.20883-(.00084*t+.25122)*cos(g5)-.00604*cos(2*g5)+.0026*cos(2*g5 -2*g6)-.0017*cos(3*g5-5*g6)-.00106*sin(2*g5-2*g6)-.00091*t*sin(g5) into r5
add j/206265 to l5
put b/206265 into b5
put r5*cos(b5)*sin(l5-l) into n9
put r5*cos(b5)*cos(l5-l)+r into d9
put atan(n9/d9) into l1
if d9<0 then add pi to l1
put l+l1 into ll
put n9*n9+d9*d9 into v
put sqrt(v+(r5*sin(b5))^2) into rr
put r5*sin(b5)/rr into s
put atan(s/sqrt(1-s*s)) into bb
put (84428-47*t)/206265 into e
put sin(ll)*cos(e)-tan(bb)*sin(e) into n9
put cos(ll) into d9
put atanq(d9,n9) into a5
put sin(bb)*cos(e)+cos(bb)*sin(e)*sin(ll) into s
put atan(s/sqrt(1-s*s)) into d5
subtract 1 from t
put fac*rmod(268.04+.107*t) into a1
put fac*rmod(64.49-.015*t) into d1
put cos(d5)*sin(a1-a5) into d9
put sin(d1)*cos(d5)*cos(a1-a5)-cos(d1)*sin(d5) into n9
put atanq(d9,n9)/fac into k
put 43.3+870.27*(d-.0057755*rr)+1.291*t into w
put trunc(.5+rmod(w-k)) into clong
put 22 into GreatRedSpotLong
put rnd10(rmod(360+GreatRedSpotLong-clong)/36.552917) into nt
put "Long. Cent. Mer. = "&clong&"┬░"&return&"Red Spot Transits in"&&nt &&"h." into cd fld CL
end central
function rmod x
get 360*(x/360-trunc(x/360))
if it<0 then add 360 to it
return it
end rmod
on fetch he
global found,path
if path is empty then exit fetch
put false into found
put "JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC" into months
if he is empty then exit fetch
if number of chars of he=5 then put "0" after char 4 of he
if "--" is in path then delete char 1 to 5 of path
repeat with month=1 to 12
if item month of months is in he then exit repeat
end repeat
repeat until the number of lines of cd fld total = 0
select text of cd fld total
doMenu "Clear Text"
end repeat
put month&char 5 to 6 of he into tar
open file path
repeat
set cursor to busy
read from file path until "&"
if it is empty then
exit repeat
end if
delete last char of it
if it contains tar then
exit repeat
end if
if tar < char 4 to 7 of line 2 of it then
get empty
exit repeat
end if
end repeat
close file path
put the number of lines of it into she
if she = 0 then
-- next search
if not (the target contains "Next") then
put "No Galilean Satellite Events for "& he into line 4 of cd fld total
end if
exit fetch
end if
if not (the target contains "Next") then
put line 1 of it && return into cd fld total
put "DATE Time(UT) SP Radii" & return into line 2 of cd fld total
end if
repeat with i=2 to she
put "(not visible)" into temp
put word 3 of line i of it into time
put (line 4 of fld rise + .5) mod 24 into jr
put (line 5 of fld rise - .5) mod 24 into js
put (char 1 to 2 of time+(char 4 to 5 of time)/60+24-DSTcheck()) mod 24 into time
put line 4 of fld rise of cd sun - .5 into str
put line 5 of fld rise of cd sun + .5 into sts
if time <str or time >sts then
put jr>time into a
put js>time into b
-- change 12's to 11.5, 12.5
put jr>11.5 into c
put js>12.5 into d
if (a is b) and (c and not d) then
put empty into temp
else if (c is d) and (b and not a) then
put empty into temp
else if (b is d) and not (a is c) then
put empty into temp
end if
end if
if (the target contains "Next" and temp is empty and cd fld total is empty) then
put line 1 of it && return&"DATE Time(UT) SP Radii" & return into cd fld total
end if
if not (the target contains "Next") or (the target contains "Next" and temp is empty) then put item month of months&&char 5 to 6 of he&&word 3 of line i of it &&" "&word 1 of line i of it&&(word 4 of line i of it)/10 && temp & return after cd fld total
if temp is empty then put true into found
end repeat
ftype "Total",6
end fetch
-- part 16 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=398 top=181 right=205 bottom=437
-- title width / last selected line: 0
-- icon id / first selected line: 31949 / 31949
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Satellite
----- HyperTalk script -----
on mouseUp
get the seconds
add DSTcheck()*3600 to it
convert it to dateitems
put item 1 of it into line 3 of joe
put item 2 of it into line 1 of joe
put item 3 of it +(item 4 of it)/24 + (item 5 of it)/1440 into line 2 of joe
PutClipboard(joe)
open "JSAT"
end mouseUp
-- part 18 (field)
-- low flags: 00
-- high flags: 0002
-- rect: left=41 top=184 right=283 bottom=348
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 15036
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: total
-- part 19 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=6 top=313 right=334 bottom=87
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Today
----- HyperTalk script -----
on mouseUp
put char 1 to 3 of second word of nDate(1,12,0) && first word of nDate(1,12,0) into he
fetch he
end mouseUp
-- part 20 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=283 top=313 right=334 bottom=364
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Other Days
----- HyperTalk script -----
on mouseUp
Ask "Enter date (mon dd):"
put it into he
fetch he
end mouseUp
-- part 21 (button)
-- low flags: 00
-- high flags: A003
-- rect: left=90 top=313 right=334 bottom=171
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Tomorrow
----- HyperTalk script -----
on mouseUp
put char 1 to 3 of second word of nDate(1,12,1) && first word of nDate(1,12,1) into he
fetch he
end mouseUp
-- part 22 (button)
-- low flags: 00
-- high flags: 8003
-- rect: left=375 top=313 right=334 bottom=460
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Next Event
----- HyperTalk script -----
on mouseUp
global found
put 0 into n
put false into found
repeat until found
add 1 to n
put char 1 to 3 of word 2 of nDate(1,12,n) && word 1 of nDate(1,12,n) into he